package com.hourses.controller;

import com.hourses.page.Page;
import com.hourses.pojo.InStore;
import com.hourses.pojo.Result;
import com.hourses.service.impl.InstoreServiceImpl;
import com.hourses.service.impl.StoreServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author:LiTao
 * @Date:2025/5/9 23:26
 */
@RestController
@RequestMapping("/instore")
public class InstoreController {
    //查询仓库列表    http://localhost:3000/api/instore/store-list
    @Autowired
    private StoreServiceImpl storeService;
    @GetMapping("/store-list")
    public Result getStoreList(){
        Result result = storeService.selectAllStores();
        return result;
    }


    //分页查询入库列表    http://localhost:3000/api/instore/instore-page-list    GET
    //前端传后端：   instore对象：
                        // storeId
                        // productName
                        // startTime
                        // endTime
                // page对象：
                        // pageSize
                        // pageNum
                        // totalNum
    //后端传前端：   instore对象：
                        //ins_id
                        //store_name
                        //product_name
                        //in_num
                        //in_price
                        //is_in
                        //user_name
                        //now()
    @Autowired
    private InstoreServiceImpl instoreService;

    //分页展示入库列表
    @GetMapping("/instore-page-list")
    public Result selectInstorePageList(InStore inStore, Page page){
        Result result = instoreService.selectInstorePageList(inStore, page);
        return result;
    }

    //最终确认入库   http://localhost:3000/api/instore/instore-confirm
    @RequestMapping("/instore-confirm")
    public Result endInStore(@RequestBody InStore inStore){
        Result result = instoreService.endInStore(inStore);
        return result;
    }
}
